#include "categorydetail.h"
#include "article.h"

CategoryDetail::CategoryDetail(const int idCategory, const int idSource,QObject *parent)
    :QObject(parent)
    ,m_cInfo(CategoryInfo(idCategory, idSource))
    ,m_listArticleId()
    ,m_listArticleData()

{
    m_listArticleId.clear();
    m_listArticleData.clear();
}

CategoryDetail::CategoryDetail(   int _idCategory,
                                  QList < int64_t > _listArticleId,
                                  QList < Article* > _listArticleByCategory,
                                  QObject *parent)
    :QObject(parent),
    m_cInfo(CategoryInfo(_idCategory, 999)),
    m_listArticleId(_listArticleId),
    m_listArticleData(_listArticleByCategory)

{
}

void CategoryDetail::setArticleData(QList<Article *> listArticleData)
{
    for(int i = 0; i< listArticleData.size(); ++i){
        Article* art = listArticleData.at(i);
        if(art){
            m_listArticleData.append(art);
            m_listArticleId.append(art->getId());
        }
    }
}


